package com.excesys.exsecs.scada.controller;


import com.excesys.exsecs.common.core.util.R;
import com.excesys.exsecs.scada.service.ScadaFileService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import com.excesys.exsecs.common.file.core.FileProperties;

import java.io.File;

@RestController
@RequiredArgsConstructor
@RequestMapping("/scadaFile")
public class FileUploadController {

	private final ScadaFileService scadaFileService;
	private final FileProperties fileProperties;

	/**
	 * 本地文件上传
	 */
	@PostMapping("/localUpload")
	public R localUpload(@RequestPart("file") MultipartFile file){
		return scadaFileService.localUpload(file);
	}

	/**
	 * 测试
	 */
	@GetMapping("/test")
	public R getAbPath(String path){
		File file = new File(path);
		return R.ok(file.getAbsolutePath());
	}

}
